#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int n, m, ans;
int dx[] = { 2,1,-1,-2 };
int dy[] = { 1,2,2,1 };

void dfs(int x, int y) {
	if (x == n && y == m) {
		ans++;
		return;
	}
	for (int i = 0; i < 4; i++) {
		int nx = x + dx[i], ny = y + dy[i];
		if (nx >= 0 && nx <= n && ny >= 0 && ny <= m) {
			dfs(nx, ny);
		}
	}
}


int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> m;
	dfs(0, 0);
	cout << ans << endl;
	return 0;
}